#!/usr/bin/bash

source $HOME/.bash_profile
conda activate lxb39
cd ~/projects/LLaVA
MODEL_PATH=$CKPTS/mamba-vl-790m-hf
DATA_PATH=$DATASETS/LLaVA-Pretrain/blip_laion_cc_sbu_558k.json
IMAGE_FOLDER=$DATASETS/LLaVA-Pretrain/images
VISION_TOWER=$CKPTS/clip-vit-large-patch14-336
PRETRAIN_MM_MLP_ADAPTER=None
COCO_CAPTION_PROMPT_FILE=$PROJECTS/LLaVA/coco_caption_prompt.txt
OUTPUT_DIR=$OUTPUTS/LLaVA/mamba-vl-790m-1st-vision-projector-epochs-1-lr-projector-1e-3-mamba-6e-4-wd-0.0


deepspeed --master_port=23333 --include="localhost:0,1,2,3,4,5,6,7"  llava/train/train_mem.py \
    --model_name_or_path $MODEL_PATH \
    --version plain \
    --data_path $DATA_PATH \
    --image_folder $IMAGE_FOLDER \
    --vision_tower $VISION_TOWER \
    --mm_projector_type mlp2x_gelu \
    --tune_mm_mlp_adapter False \
    --tune_vision_tower False \
    --vision_tower_lr 6e-4 \
    --vision_tower_lldr 0.9 \
    --coco_caption_sft False \
    --coco_caption_prompt_file $COCO_CAPTION_PROMPT_FILE \
    --mm_vision_select_layer -2 \
    --mm_use_im_start_end False \
    --mm_use_im_patch_token False \
    --fp16 False \
    --bf16 False \
    --output_dir $OUTPUT_DIR \
    --num_train_epochs 1 \
    --per_device_train_batch_size 32 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 2000 \
    --save_total_limit 1 \
    --mm_projector_lr 1e-3 \
    --mm_projector_wd 0.0\
    --learning_rate 6e-4 \
    --weight_decay 0.0 \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 2048 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --report_to wandb
